/**
 * Project Name:sc-compute-service
 * File Name:ShipingController.java
 * Package Name:com.sc.test.service
 * Date:2016年12月12日下午1:18:08
 * Copyright (c) 2016, 杭州知时信息科技有限公司 All Rights Reserved.
 *
*/

package com.sc.test.service;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName:ShipingController <br/>
 * Function: <br/>
 * Date: 2016年12月12日 下午1:18:08 <br/>
 * 
 * @author guooo
 * @version
 * @since JDK 1.6
 * @see
 */
@RestController
public class ShipingController {

    private final Logger logger = Logger.getLogger(getClass());

    @Autowired
    private DiscoveryClient client;

    @RequestMapping(value = "/send", method = RequestMethod.GET)
    public String send(@RequestParam String message) {

        ServiceInstance instance = client.getLocalServiceInstance();
        logger.info(message+"!!!!");
        logger.info("/add, host:" + instance.getHost() + ", service_id:" + instance.getServiceId());
        return "spring cloud eureka >" +message;
    }
}
